#include "StdAfx.h"
#include "JCD.h"


vector<double> JCD::JointHistograms(vector<double>& cedd, vector<double>& fcth)
{
	vector<double> jcd(168);
	double temp1[24], temp2[24], temp3[24], temp4[24];

	for (int i = 0; i < 24; i++)
	{
		temp1[i] = fcth[i + 0] + fcth[i + 96];
		temp2[i] = fcth[i + 24] + fcth[i + 120];
		temp3[i] = fcth[i + 48] + fcth[i + 144];
		temp4[i] = fcth[i + 72] + fcth[i + 168];
	}

	for (int i = 0; i < 24; i++)
	{
		jcd[i + 0]	= (temp1[i] + cedd[i]) / 2;
		jcd[i + 24]	= (temp2[i] + cedd[i + 48]) / 2;
		jcd[i + 48] = cedd[i + 96];
		jcd[i + 72] = (temp3[i] + cedd[i + 72]) / 2;
		jcd[i + 96] = cedd[i + 120];
		jcd[i + 120] = temp4[i];
		jcd[i + 144] = cedd[i + 24];
	}

	return (jcd);
}
